\(\int \frac {-2+x^2}{(1+x^2)^2} \, dx\) [112]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 13, antiderivative size = 19 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {3 x}{2 \left (1+x^2\right )}-\frac {\arctan (x)}{2} \]

[Out]

-3/2*x/(x^2+1)-1/2*arctan(x)

Rubi [A] (verified)

Time = 0.00 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {393, 209} \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {\arctan (x)}{2}-\frac {3 x}{2 \left (x^2+1\right )} \]

[In]

Int[(-2 + x^2)/(1 + x^2)^2,x]

[Out]

(-3*x)/(2*(1 + x^2)) - ArcTan[x]/2

Rule 209

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[b, 2]))*ArcTan[Rt[b, 2]*(x/Rt[a, 2])], x] /;
 FreeQ[{a, b}, x] && PosQ[a/b] && (GtQ[a, 0] || GtQ[b, 0])

Rule 393

Int[((a_) + (b_.)*(x_)^(n_))^(p_)*((c_) + (d_.)*(x_)^(n_)), x_Symbol] :> Simp[(-(b*c - a*d))*x*((a + b*x^n)^(p
 + 1)/(a*b*n*(p + 1))), x] - Dist[(a*d - b*c*(n*(p + 1) + 1))/(a*b*n*(p + 1)), Int[(a + b*x^n)^(p + 1), x], x]
 /; FreeQ[{a, b, c, d, n, p}, x] && NeQ[b*c - a*d, 0] && (LtQ[p, -1] || ILtQ[1/n + p, 0])

Rubi steps \begin{align*} \text {integral}& = -\frac {3 x}{2 \left (1+x^2\right )}-\frac {1}{2} \int \frac {1}{1+x^2} \, dx \\ & = -\frac {3 x}{2 \left (1+x^2\right )}-\frac {1}{2} \tan ^{-1}(x) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.01 (sec) , antiderivative size = 19, normalized size of antiderivative = 1.00 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {3 x}{2 \left (1+x^2\right )}-\frac {\arctan (x)}{2} \]

[In]

Integrate[(-2 + x^2)/(1 + x^2)^2,x]

[Out]

(-3*x)/(2*(1 + x^2)) - ArcTan[x]/2

Maple [A] (verified)

Time = 2.52 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.84

method result size
default \(-\frac {3 x}{2 \left (x^{2}+1\right )}-\frac {\arctan \left (x \right )}{2}\) \(16\)
risch \(-\frac {3 x}{2 \left (x^{2}+1\right )}-\frac {\arctan \left (x \right )}{2}\) \(16\)
meijerg \(-\frac {x}{2 \left (x^{2}+1\right )}-\frac {\arctan \left (x \right )}{2}-\frac {2 x}{2 x^{2}+2}\) \(28\)
parallelrisch \(-\frac {i \ln \left (x +i\right ) x^{2}-i \ln \left (x -i\right ) x^{2}+i \ln \left (x +i\right )-i \ln \left (x -i\right )+6 x}{4 \left (x^{2}+1\right )}\) \(52\)

[In]

int((x^2-2)/(x^2+1)^2,x,method=_RETURNVERBOSE)

[Out]

-3/2*x/(x^2+1)-1/2*arctan(x)

Fricas [A] (verification not implemented)

none

Time = 0.26 (sec) , antiderivative size = 21, normalized size of antiderivative = 1.11 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {{\left (x^{2} + 1\right )} \arctan \left (x\right ) + 3 \, x}{2 \, {\left (x^{2} + 1\right )}} \]

[In]

integrate((x^2-2)/(x^2+1)^2,x, algorithm="fricas")

[Out]

-1/2*((x^2 + 1)*arctan(x) + 3*x)/(x^2 + 1)

Sympy [A] (verification not implemented)

Time = 0.05 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.79 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=- \frac {3 x}{2 x^{2} + 2} - \frac {\operatorname {atan}{\left (x \right )}}{2} \]

[In]

integrate((x**2-2)/(x**2+1)**2,x)

[Out]

-3*x/(2*x**2 + 2) - atan(x)/2

Maxima [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.79 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {3 \, x}{2 \, {\left (x^{2} + 1\right )}} - \frac {1}{2} \, \arctan \left (x\right ) \]

[In]

integrate((x^2-2)/(x^2+1)^2,x, algorithm="maxima")

[Out]

-3/2*x/(x^2 + 1) - 1/2*arctan(x)

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 15, normalized size of antiderivative = 0.79 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {3 \, x}{2 \, {\left (x^{2} + 1\right )}} - \frac {1}{2} \, \arctan \left (x\right ) \]

[In]

integrate((x^2-2)/(x^2+1)^2,x, algorithm="giac")

[Out]

-3/2*x/(x^2 + 1) - 1/2*arctan(x)

Mupad [B] (verification not implemented)

Time = 5.13 (sec) , antiderivative size = 17, normalized size of antiderivative = 0.89 \[ \int \frac {-2+x^2}{\left (1+x^2\right )^2} \, dx=-\frac {\mathrm {atan}\left (x\right )}{2}-\frac {3\,x}{2\,\left (x^2+1\right )} \]

[In]

int((x^2 - 2)/(x^2 + 1)^2,x)

[Out]

- atan(x)/2 - (3*x)/(2*(x^2 + 1))